/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import control.MStockMidlet;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Image;
import listener.Command;
import model.ErrorMessage;
import model.RecycleData;

/**
 *
 * @author kien.tran
 */
public abstract class AForm {

    protected MStockMidlet control;
    protected Display display;
    protected Command ok, back;

    protected Image background;
    protected Image icon;

    protected String[] lang;

    protected RecycleData recycle;

    protected int branch;
    protected int option;

    public AForm() {
    }

    public AForm(MStockMidlet control, Display display) {
        this.control = control;
        this.display = display;
        this.background = control.getBackground();
    }

    public Image getBackground() {
        return background;
    }

    public void setBackground(Image background) {
        this.background = background;
    }

    public MStockMidlet getControl() {
        return control;
    }

    public void setControl(MStockMidlet control) {
        this.control = control;
    }

    public Display getDisplay() {
        return display;
    }

    public void setDisplay(Display display) {
        this.display = display;
    }

    public Image getIcon() {
        return icon;
    }

    public void setIcon(Image icon) {
        this.icon = icon;
    }

    public String[] getLang() {
        return lang;
    }

    public void setLang(String[] lang) {
        this.lang = lang;
    }

    protected abstract void initData();

    protected abstract void initGui();

    protected abstract void loadData();

    protected abstract void showData();

    protected abstract void showError(ErrorMessage error);

    public void show() {
        initData();
        initGui();
    }

    public void setOption(int branch, int op) {
        this.branch = branch;
        this.option = op;
    }

    public void setProperties(MStockMidlet control, Display display){
        this.control = control;
        this.display = display;
    }
}
